<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>美兰数据文化馆与图书馆</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
    <style>
        .layui-table th {
            font-size: 16px;
            font-weight: 600;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <table lay-filter="getGroupDepartments" class="layui-table" lay-data="{url:'<%=request.getContextPath()%>/rest/reporting/getGroupDepartment',defaultToolbar: ['filter','print'], cellMinWidth: 80, page:false,toolbar: '#getGroupDepartment',height: 'full-100',totalRow:true}">
                        <thead>
                        <tr>
                            <th lay-data="{align:'center'}" colspan="7">负责部门物资分布汇总表</th>
                        </tr>
                        <tr>
                            <th lay-data="{align:'right'}" colspan="7">统计区间：${year}年01月-${year}年11月</th>
                        </tr>
                        <tr>
                            <th lay-data="{field:'number',align: 'center',width:'4%'}" >序号</th>
                            <th lay-data="{field:'department',align: 'center',width:'16.2%',totalRowText: '合计'}" >负责部门名称</th>
                            <th lay-data="{field:'allCount',align: 'center',width:'16%',totalRow: true}" >物资总数</th>
                            <th lay-data="{field:'inCount',align: 'center',width:'16%',totalRow: true}" >在库数量</th>
                            <th lay-data="{field:'outCount',align: 'center',width:'16%',totalRow: true}">出库数量</th>
                            <th lay-data="{field:'maintainCount',align: 'center',width:'16%',totalRow: true}">维保数量</th>
                            <th lay-data="{field:'scrapCount',align: 'center',width:'16%',totalRow: true}">报废数量</th>
                        </tr>
                        </thead>
                    </table>
                    <div style="padding-top: 5px;"> <div style="text-align: right" > 制表人：${user.name}<input type="text"  style="visibility:hidden;width:20px;"> 制表时间：${datetime}&nbsp;</div></div>
                </div>

            </div>
        </div>
    </div>
</div>
<script type="text/html" id="getGroupDepartment">
    <div class="layui-inline" lay-event="exports" title="导出">
        <i class="layui-icon layui-icon-export"></i>
    </div>
</script>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script>
    layui.use(['table'], function(){
        var $ = layui.$
            , table = layui.table;


        //监听头工具栏事件
        table.on('toolbar(getGroupDepartments)', function(obj){
            var checkStatus = table.checkStatus(obj.config.id)
                ,data = checkStatus.data;//获取选中的数据
            switch(obj.event){
                case 'exports':
                    exports(data);
                    break;
            };
        });

        function exports(data){
            var url="<%=request.getContextPath()%>/rest/reporting/getGroupDepartmentExcel?typename=负责部门物资分布汇总表";
            window.open(url);
        }
    });
</script>
</body>
</html>